--虚弱化
local xuruohua = fk.CreateSkill{
    name =  "mcdh_xuruohua",
}

xuruohua:addEffect(fk.DamageInflicted,{
    can_trigger = function(self, event, target, player, data)
        if player:hasSkill(self) and player:inMyAttackRange(target) then
            local equipSlots = table.simpleClone(target.equipSlots)
            for _ ,slot in ipairs(equipSlots) do
                if table.contains(target.sealedSlots,slot) then
                    return true
                end
            end
        end
    end,

    on_cost = function(self, event, target, player, data)
        local room = player.room
        local equipSlots = table.simpleClone(target.equipSlots)
        local choices ={}
        for _ ,slot in ipairs(equipSlots) do
            if table.contains(target.sealedSlots,slot) then
                table.insertIfNeed(choices,slot)
            end
        end
        table.insertIfNeed(choices,"cancel")
        local choice = room:askForChoice(player, choices, self.name, "#xuruohua-recover")
        if choice ~= "cancel" then
            self.cost_data = choice
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:resumePlayerArea(target, self.cost_data)
        data.damage = data.damage +1
        room:addPlayerMark(target, "@@xuruohua-turn")
    end
})

xuruohua:addEffect('prohibit',{
    prohibit_use = function(self, player, card)
        if player:getMark("@@xuruohua-turn") > 0 then
            local subcards = card:isVirtual() and card.subcards or {card.id}
            return #subcards > 0 and table.every(subcards, function(id)
                return table.contains(player:getCardIds(Player.Hand), id)
            end)
        end
    end,
    prohibit_response = function(self, player, card)
        if player:getMark("@@xuruohua-turn") > 0 then
            local subcards = card:isVirtual() and card.subcards or {card.id}
            return #subcards > 0 and table.every(subcards, function(id)
                return table.contains(player:getCardIds(Player.Hand), id)
            end)
        end
    end,
})

return xuruohua